﻿using System.Web.Mvc;
using STX.Lib.Security;


namespace STX.Web.Framework.Security.SafeCode
{
    public partial class SecurityController : Controller
    {

        public ISafeCodeProvider SafeCodeProvider { get; set; }

        #region 生成验证码图片
        /// <summary>
        /// 生成验证码图片
        /// </summary>
        /// <returns></returns>
        public ActionResult SafeCode()
        {
            var vCode = new STX.Lib.Security.SafeCodeImg();
            byte[] imagedate = vCode.CreateSafeCode(SafeCodeProvider.NewSafeCode(this.ControllerContext.HttpContext.Session.SessionID));
            return File(imagedate, @"image/jpeg" );
        }
        #endregion
    }
}
